var express = require('express');
var router = express.Router();
var svgCaptcha = require("svg-captcha")
router.get('/',function(req,res){
    var codeConfig = {
        size: 5,// 验证码长度
         ignoreChars: '0o1i', // 验证码字符中排除 0o1i
         noise: 2, // 干扰线条的数量
         fontSize:42,
         color:false,//开启文字颜色
         background:"#cc9966",//背景色
         width:150,
         height: 44
    }
     var captcha = svgCaptcha.create(codeConfig);
     req.session.captcha = captcha.text.toLowerCase(); //存session用于验证接口获取文字码
     console.log(req.session.captcha)
     var codeData = {
         img:captcha.data
     }
    res.type('svg');
     res.status(200).send(captcha.data);
})
module.exports = router;